print_cache = Dict()

"""
    info_onchange(msg, key, location)

This macro is used to gate verbose messages within a function; within functions
such as `verify()`, we want to print out that we successfully verified a file
only once per session, so we keep track of which log message we printed within
a particular method.  This is done by passing a `key` to `@info_onchange` as
the second parameter, e.g. in the above scenario we might pass the string
`"verify_\$(filepath)"`.  Combined with this key is the file and line the
message originates from, which is used to suppress duplicate messages; e.g.
if a method with two branches that both log with the same key is called, if the
execution path is branch A, A, B, A, B, B, B, A then what will be printed is
message A, B, A, B, A.  In essence, this method calls `info()` only when the
message generated by this particular method changes.
"""
function info_onchange(msg, key, location)
    local cache_val = get(print_cache, key, nothing)
    if cache_val != location
        info(msg)
        print_cache[key] = location
    end
end